package com.lzh.others.java7.trywithresources;

import java.io.File;
import java.io.IOException;

/**
 * @Description:
 * @Author: LiuZiHao
 * @Date: 2022/7/26 11:22
 */
public class FileTest {
    public static void main(String[] args) {
        try {
            File file = new File("D:\\测试\\" + "test.txt");
            if (file.getParentFile().exists()) {
                System.out.println("FileTest.main.file.getParentFile().exists()");
            }
            if (file.exists()) {
                System.out.println("file = " + file);
            } else {
                boolean newFile = file.createNewFile();
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
